/**
 * Created by yubaolin on 2017/9/27.
 */
import ajax from '../ajax'

export default {
  getList (success, fail = null) {
    ajax.get({url: '/api/community', success, fail})
  },
  save (shop, success, fail = null) {
    const method = shop.id === 0 ? 'post' : 'put'
    ajax[method]({url: `/api/community/${shop.id}`, data: shop, success, fail})
  },
  delete (id, success, fail = null) {
    ajax.del({url: `/api/community/${id}`, success, fail})
  },
  deleteList (ids, success, fail = null) {
    ajax.del({url: `/api/community/deleteList`, data: {ids}, success, fail})
  }
}
